//
//  TMUseDiscountView.m
//  国学培训用户端
//
//  Created by Tao Li on 2018/8/31.
//  Copyright © 2018年 mac. All rights reserved.
//

#import "TMUseDiscountView.h"
#import "TMMyDiscountViewController.h"
@interface TMUseDiscountView()
@property (nonatomic, strong) TMMyDiscountViewController *vc;

@end

@implementation TMUseDiscountView
- (IBAction)closeBtnAction:(UIButton *)sender {
    [self removeFromSuperview];
}
- (void)setRealCid:(NSInteger)realCid{
    _realCid = realCid;
    self.vc.realCid = realCid;
}
-(void)setIsmine:(BOOL)ismine{
    _ismine = ismine;
    self.vc.isMine = ismine;
}
- (void)setType:(WhereDiscount)type{
    _type = type;
    self.vc.distype = type;
}
-(void)awakeFromNib{
    [super awakeFromNib];
    self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
    self.vc = [[UIStoryboard storyboardWithName:@"Mine" bundle:nil] instantiateViewControllerWithIdentifier:@"TMMyDiscountViewController"];
    [self.chartView addSubview:self.vc.view];
    self.vc.isMine = self.ismine;
    self.vc.distype = _type;
    self.vc.view.frame = self.chartView.bounds;
    self.vc.cid = self.cid;
    self.vc.realCid = self.realCid;
}

-(void)setCid:(NSInteger)cid{
    _cid = self.cid;
    self.vc.cid = cid;
}
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInView:self];
    if (location.y > kWindowH/3) {
        
    }else{
        [self removeFromSuperview];
    }
    
}
@end
